package com.eaoa.uc.permission.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.eaoa.base.EABaseAction;
import com.eaoa.query.pub.PubRoleQuery;
import com.eaoa.uc.permission.form.RoleCondition;
import com.eaoa.uc.permission.form.RoleSearchForm;

public class RoleManageSearchAction extends EABaseAction {
	protected ActionForward doWork(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {

		RoleSearchForm sform = (RoleSearchForm) form;
		sform.initConditionPost();
		RoleCondition condition = (RoleCondition) sform.getCondition();

		PubRoleQuery query = new PubRoleQuery();
		query.setRolecode(condition.getRolecode());
		query.setRolename(condition.getRolename());
		query.setSort();
		query.execute();

		request.setAttribute("results", query.getResults());
		
		return mapping.findForward("success");
	}
}
